#include "mat_ui_yesno.h"
#include "mat_ui_helper.h"

#include "gameflow/ui_popup.h"

MATUIYesNo::MATUIYesNo(gameflow::UIPopup* pPopup)  : 
							MATUIPopupAnimator(pPopup)
{
	
	
	if(m_pPopup)
	{
		m_pAnimateWidget = m_pPopup->GetWidget("BG");
		MATUIPopupAnimatorMgr::Instance().AddPopupAnimator(MATUIPopupAnimatorMgr::POPUP_NAMES_YESNO,this);
		//m_pPopup->SetWidgetFunctor("Button_Close",UI_DELEGATE(MATUIYesNo, OnButtonClose));
		
		//m_pButtons.push_back(new MATUIHelper(m_pPopup->GetWidget("YesWidget")));
		//m_pButtons.push_back(new MATUIHelper(m_pPopup->GetWidget("NoWidget")));
		

	}
	m_Type = ANIMATION_MSGPOPUP;

}

MATUIYesNo::~MATUIYesNo()
{
	for(int i = 0; i < (int)m_pButtons.size(); i++)
	{
		UTIL_SAFE_DELETE(m_pButtons[i]);
	}
	m_pButtons.resize(0);

}

void	MATUIYesNo::Tick(float dt)
{
	if(!m_pPopup->IsActive())
		return;

	for(int i = 0; i < (int)m_pButtons.size(); i++)
	{
		m_pButtons[i]->Tick(dt);
	}
}